package com.weixing.mall.provider.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.weixing.mall.core.support.auth.SysAuth;
import com.weixing.mall.provider.api.model.enums.OrderTypeEnum;
import com.weixing.mall.provider.api.model.vo.ActOrderSettleVo;
import com.weixing.mall.provider.api.model.vo.SealingSheetOrderVo;
import com.weixing.mall.provider.api.model.vo.TransferListVo;
import com.weixing.mall.provider.model.domain.Order;
import com.weixing.mall.provider.model.domain.OrderAgent;
import com.weixing.mall.provider.model.dto.*;
import com.weixing.mall.provider.model.enums.OrderFrontStateEnum;
import com.weixing.mall.provider.model.query.*;
import com.weixing.mall.provider.model.vo.*;
import com.weixing.mall.provider.model.vo.member.MemberOrderVo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单模块-订单表 服务类
 * </p>
 *
 * @author Small
 * @since 2019-11-20
 */
public interface IOrderService extends IService<Order> {

    OrderDetilVo selectOrderDetails(long id);

    OrderDetilTimeVo selectOrderDetailsTime(long id);

    void changeOrderStatus(ChgOrderStatusDto chgOrderStatusDto);

    void changeOrderPayStatus(ChgOrderPayStatusDto chgOrderPayStatusDto);


    void PushOrderSn(String[] id);

    IPage selectUntyingList(OrderUntyingQuery orderUntyingQuery, Page initMpPage);

    IPage selectDistributionShipperList(OrderPCQuery orderPCQuery, Page initMpPage);

    IPage<OrderListPCVo> selectDeliverOrderList(OrderPCQuery orderPCQuery, Page initMpPage);
    StaticVo deliverOrderTotal(OrderPCQuery orderPCQuery);

    void distributionShipper(List<DistributionShipperDto> distributionShipperDtoList);

    void shipperChgDepot(ShipperChgInfoDto shipperChgInfoDto, Long uid);

    IPage goodsIdentification(GoodsIdentificationQuery goodsIdentificationQuery, Page initMpPage);

    List<GoodsIdentificationVo> goodsIdentification(GoodsIdentificationQuery goodsIdentificationQuery);


    IPage selectAgentClaimList(AgentClaimQuery agentClaimQuery, Page initMpPage);

    void customerChgOrder(CustomerChgOrderDto customerChgOrderDto, Long uid);

    IPage selectOutOfStockList(Page initMpPage, CustomerOrderQuery customerOrderQuery, Long uid);

    StaticVo selectOutOfStockListTotal(CustomerOrderQuery customerOrderQuery);

    HashMap<String, Object> selectKefuOrderList(Page initMpPage, FrontCustomerOrderQuery frontCustomerOrderQuery, Long uid);

    FrontCustomerOrderDetailsVo selectFrontCustomerOrderDetails(Long id);

    OrderShowVo selectOrderShowVo(OrderVoQuery orderVoQuery);

    Page<MemberOrderVo> selectListByFrontStatus(Page page, OrderFrontStateEnum status, Long mid);

    IPage<MemberOrderVo> seachOrderList(Page page, OrderSeachQuery orderSeachQuery);


    void changeFrontOrderStatus(ChgFrontOrderStatusDto chgFrontOrderStatusDto);

    IPage unshippedOrder(ShipperOrderQuery shipperOrderQuery, Page initMpPage, Long uid);

    IPage deliverOrderList(ShipperOrderQuery shipperOrderQuery, Page initMpPage, Long uid);

    void updateGoodsStatus(FrontShipperUpdateGoodsStatusDto frontShipperUpdateGoodsStatusDto);

    void confirmShipments(Long orderId, SysAuth auth,String depotSn,String expressSn);

    ScanCodeGoodsDetilVo selectScanCodeGoodsDetails(ScanCodeGoodsDetilQuery scanCodeGoodsDetilQuery);

    ScanCodeGoodsDetilVo selectScanCodeGoodsDetails(String qrCodeValue);

    ScanCodeAfterSaleVo selectScanCodeReceiveDetails(ScanCodeGoodsDetilQuery scanCodeGoodsDetilQuery);

    Long selectProductId(ProductIdQuery productIdQuery);

    OrderTypeEnum selectByAgentSn(String orderSn);

    IPage historyOrder(Page initMpPage, OrderPCQuery orderQuery);

    IPage historyOrder2(Page initMpPage, OrderPCQuery orderQuery);


    IPage sealingSheetOrderList(Page initMpPage, SealingSheetOrderQuery sealingSheetOrderQuery);

    List<SealingSheetOrderVo> sealingSheetOrderList();

    void updateSealingSheetOrder(Long orderId, Long depotId, String depotName);

    String createBillTrands(String orderIds, Long depotId, String depotName,Long uid);


    int getCountfrontOrder(Long memberId, Integer frontOrderStatus);

    IPage byDepotId(Page initMpPage, Long depotId);

    List<TransferListVo> byDepotId(Long depotId);


    void updateStatus(Integer depotId);

    void bind(Long id, Long agentId, String remark, Long uid);

    IndexOrderReportVo getAdminIndexOrderReport();

    /**
     * 销售统计
     * @param startTime  参数格式yyyy-MM-dd
     * @param endTime    参数格式yyyy-MM-dd
     * @return List<IndexSaleReportVo>
     */
    List<IndexSaleReportVo> getAdminIndexSaleReport(String startTime, String endTime);

    List<ActOrderSettleVo> selectAgentActOrdersByActId(Long actId);

    void confirmOrder(Long mid, Long orderId);

    void autoConfirmOrder();

    void executeSeckillOrderImport(List<Order> orderList, List<OrderAgent> orderAgentList);

    Order findByOrderSn(String orderSn);

    void cancelOrder(long orderId);

    void updateTag(Long orderId,Integer sysTag,Integer appTag);


    Map<String,Object> getAgentRuleData(Long agentId, String startTime, String endTime);

    /**
     * 订单在客服未审核前恢复到分配发货员后的状态
     * @param orderId
     */
    void resetOrderStatus(Long orderId);

    /**
     * 发货员更换货品尺码
     */
    void changsCode(Long orderId,Long productId,Boolean flag);

}
